<template>
  <div class="app-container">
    <div class="app-container-header">
      <el-form>
        <el-form-item label="状态：" prop="status">
          <el-select v-model="query.status" clearable placeholder="请选择状态">
            <el-option
              v-for="(key, val) in statusMap"
              :key="key"
              :label="key"
              :value="val"
            />
          </el-select>
        </el-form-item>
        <el-form-item>
          <el-button type="primary" size="small" @click="selected"
            >查询</el-button
          >
          <el-button plain size="small" @click="reset">重置</el-button>
        </el-form-item>
      </el-form>
    </div>

    <el-table
      :data="list"
      :header-row-style="{
        'background-color': '#E6E6E6',
        'font-weight': 'bold',
        color: '#333'
      }"
      :tree-props="{ children: 'children', hasChildren: 'hasChildren' }"
      style="width: 100%; margin-bottom: 20px"
      row-key="id"
    >
      <el-table-column
        show-overflow-tooltip
        align="center"
        prop="orderCode"
        label="订单编号"
      />
    </el-table>

    <el-pagination
      :current-page="query.page"
      :total="total"
      :page-size="query.limit"
      style="padding: 30px 0; text-align: end"
      layout="total, prev, pager, next,jumper"
      @current-change="fetchData"
    />
  </div>
</template>

<script>
// import user from "@/api/acl/user.js";

export default {
  name: "quality-product",

  data() {
    return {
      statusMap: {
        0: "待审核",
        1: "申请中",
        2: "采购完成",
        3: "品检完成",
        4: "品检完成部分",
        5: "入库完成"
      },
      list: [],
      total: 1,
      query: {
        page: 1,
        limit: 10,
        status: ""
      }
    };
  },

  methods: {
    reset() {
      this.query = {
        // brand: "",
        // materialName: "",
        // specifications: "",
        // chartNo: "",
        status: "",
        page: 1,
        limit: 10
      };
      this.getList();
    },
    selected() {
      this.getList();
    },
    selectStatus(val) {
      this.query.status = val;
      this.getList();
    },
    fetchData(val) {
      this.query.page = val;
      this.getList();
    },
    getList() {
      //   user.purchaseList(this.query).then(response => {
      //     this.total = response.total;
      //     this.list = response.list;
      //   });
    }
  }
};
</script>

<style lang="scss"></style>
